$(function () {
  //登录状态标识
  const login_state = "LOGIN_STATE";
  //cookie中获取登录状态
  let state = getCookie(login_state);
  //cookie中有登录的状态标识且标识中的值OK,直接跳转首页
  if (!(state && state == "OK")) {
    location.href = "../html/login.html";
    localStorage.setItem("user", "");
  } else {
    setCookie(login_state, "OK", 7 * 24 * 60, "/");
  }
});
